<?php

class Mdl_administration_main extends Model
{
	function __construct()
	{
		parent::Model();
	}
	
	function Mdl_administration_main()
	{
		self::__construct();
	}
	
	
	/*get_user
	* Get the current username.
	* @return username
	*/
	function get_user()
	{
		$username = $_SESSION['username'];
		
		$this->db->where('username', $username);
		$query = $this->db->get('users');
		
		return $query->row_array();
	}
	
	/*populate_dashboard
	* Show the 10 last changes admins have made.
	* @return result_array()
	*/
	
	function populate_dashboard()
	{
		$this->config->load('auth');
		
		$this->db->limit('10');
		$this->db->order_by('id', 'DESC');
		//$this->db->where('username', $this->session->userdata('username', TRUE));
		
		$config = $this->config->item('auth_access');
		$group = $_SESSION['group_id'];
		$modules = $config[$group];
		
		$module_list = explode(',', $modules[0]);
		
		foreach($module_list as $module)
		{
			$module = trim($module);
			//$this->db->where('module', $module);
		}
		
		
		$query = $this->db->get('recent');
		
		return $query->result_array();
		
		
	} // populate_dashboard();
	
	/*clear_log
	* Clear the log of activity that the admins have made.
	* @return
	*/
	
	function clear_log()
	{
		$this->config->load('auth');
		$this->db->empty_table('recent');
	}
	
} // user_admin_model()

/* End of file user_admin_model.php */
/* Location: modules/user/models/user_admin_model.php */
